package com.sunkyc.framework.system.mapper;

import com.sunkyc.framework.system.entity.LoginRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface RoleMapper {


    /**
     * 根据用户ID查询对应的角色列表
     * @param userId
     * @return
     */
    @Select("select r.role_id,r.role_key,r.data_scope as role_data_scope from  sys_user_role as ur\n" +
            "left join sys_role as r\n" +
            "on r.role_id = ur.role_id\n" +
            "where ur.user_id =  #{userId}")
    List<LoginRole> queryLoginRoleByUserId(@Param("userId") Long userId);




}
